// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import Es6Promise from 'es6-promise'
import App from './App'
import router from './router'
import "lib-flexible/flexible"
import FastClick from 'fastclick';
import Vant from 'vant';
import 'vant/lib/index.css';
import {Lazyload} from 'vant';
import api from './common/api'
import utils from '@/common/util.js'
import func from '@/common/func.js'

Vue.use(Vant);
Vue.use(router);
Vue.use(Lazyload);
Vue.use(utils);
Vue.use(func);

require('es6-promise').polyfill();
Es6Promise.polyfill();

Vue.config.productionTip = false;

const str = navigator.userAgent.toLowerCase();
const ver = str.match(/cpu iphone os (.*?) like mac os/);

if (!ver) {
  //非IOS系统
  // 引入fastclick 做相关处理
  FastClick.attach(document.body);
}
else {
  if (parseInt(ver[1]) < 11) {
    // 引入fastclick 做相关处理
    FastClick.attach(document.body);
  }
}

//将api挂载到vue的原型上
Vue.prototype.$api=api;


/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  components: {App},
  template: '<App/>'
})
